org.eclipse.vtp.framework.engine.support
Class AbstractActionContext

java.lang.Object
  extended by org.eclipse.vtp.framework.engine.support.AbstractReporter
      extended by org.eclipse.vtp.framework.engine.support.AbstractLogger
          extended by org.eclipse.vtp.framework.engine.support.AbstractContext
              extended by org.eclipse.vtp.framework.engine.support.AbstractActionContext
All Implemented Interfaces:
IActionContext, IContext, IExecutionContext, ILogger, IProcessContext, IReporter, ISessionContext
Direct Known Subclasses:
Sequence.Context

public abstract class AbstractActionContext
extends AbstractContext
implements IActionContext

A support implementation of the IActionContext interface.

Author:
Lonnie Pryor

Field Summary
protected  IExecutionContext executionContext
          The context of the execution that created this action.
protected static java.util.Set RESERVED_SERVICE_IDENTIFIERS
          The service identifiers that will return this context.
 
Fields inherited from interface org.eclipse.vtp.framework.core.IActionContext
STATE_AFTER, STATE_BEFORE, STATE_DURING
 
Fields inherited from interface org.eclipse.vtp.framework.core.IReporter
SEVERITY_DEBUG, SEVERITY_ERROR, SEVERITY_INFO, SEVERITY_WARN
 
Constructor Summary
protected AbstractActionContext(IExecutionContext executionContext)
          Creates a new AbstractActionContext.
 
Method Summary
 void clearAttribute(java.lang.String attributeName)
          Clears the value of a session-level attribute.
 void clearParameter(java.lang.String parameterName)
          Clears the value of the execution-level parameter with the specified name.
 IActionResult createResult(java.lang.String resultName)
          Creates an action result with the specified name.
protected  void doReport(int severity, java.lang.String[] categories, java.lang.String message, java.util.Dictionary properties)
          Implementation of report creation and publication after checking the severity.
 java.lang.Object getAttribute(java.lang.String attributeName)
          Returns the value of a session-level attribute with the specified name or null if no such attribute exists.
 java.lang.String[] getAttributeNames()
          Returns the names of all the session-level attributes currently registered.
 java.lang.String getExecutionID()
          Returns the ID of this execution.
 java.lang.String getParameter(java.lang.String parameterName)
          Returns the value of the execution-level parameter with the specified name or null if no such parameter exists.
 java.lang.String[] getParameterNames()
          Returns the names of the parameters available to the execution sequence.
 java.lang.String[] getParameters(java.lang.String parameterName)
          Returns the values of the execution-level parameter with the specified name or null if no such parameter exists.
 java.lang.String getProcessID()
          Returns the ID of this process.
 java.lang.Object getProperty(java.lang.String propertyName)
          Returns the value of the process-level configuration property with the specified name or null if no such property exists.
 java.lang.String getSessionID()
          Returns the ID of the current session.
 boolean isSeverityEnabled(int severity)
          Returns true if the specified severity level is enabled.
 java.lang.Class loadClass(java.lang.String className)
          Loads a class visible to the process.
protected  java.lang.Object[] lookupAllInheritedServices(java.lang.String identifier)
          Returns all the services registered under the specified identifier in any ancestor registry or null if no such services can be found.
protected  java.lang.Object lookupInheritedService(java.lang.String identifier)
          Returns a service registered under the specified identifier in any ancestor registry or null if no such service exists.
protected  java.lang.Object lookupReservedService(java.lang.String identifier)
          Returns the reserved service if the specified identifier is one of the reserved identifiers or null if these conditions are not met.
 void setAttribute(java.lang.String attributeName, java.lang.Object attributeValue)
          Sets the value of a session-level attribute or clears it if the supplied value is null.
 void setParameter(java.lang.String parameterName, java.lang.String value)
          Sets the value of the execution-level parameter with the specified name or clears it if the value is null.
 void setParameters(java.lang.String parameterName, java.lang.String[] values)
          Sets the values of the execution-level parameter with the specified name or clears them if the value is null or empty.
 
Methods inherited from class org.eclipse.vtp.framework.engine.support.AbstractContext
lookup, lookupAll, lookupAllLocalServices, lookupLocalService
 
Methods inherited from class org.eclipse.vtp.framework.engine.support.AbstractLogger
debug, debug, debug, debug, doLog, error, error, error, error, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, log, log, log, log, warn, warn, warn, warn
 
Methods inherited from class org.eclipse.vtp.framework.engine.support.AbstractReporter
report, report, report, report
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.vtp.framework.core.IActionContext
createResult, getActionID, getActionName, getActionState
 
Methods inherited from interface org.eclipse.vtp.framework.core.IContext
lookup, lookupAll
 
Methods inherited from interface org.eclipse.vtp.framework.core.ILogger
debug, debug, debug, debug, error, error, error, error, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, log, log, log, log, warn, warn, warn, warn
 
Methods inherited from interface org.eclipse.vtp.framework.core.IReporter
report, report, report, report
 

Field Detail

RESERVED_SERVICE_IDENTIFIERS

protected static final java.util.Set RESERVED_SERVICE_IDENTIFIERS
The service identifiers that will return this context.


executionContext

protected final IExecutionContext executionContext
The context of the execution that created this action.

Constructor Detail

AbstractActionContext

protected AbstractActionContext(IExecutionContext executionContext)
                         throws java.lang.NullPointerException
Creates a new AbstractActionContext.

Parameters:
executionContext - The context of the execution that created this action.
Throws:
java.lang.NullPointerException - If the supplied session context is null.
Method Detail

doReport

protected void doReport(int severity,
                        java.lang.String[] categories,
                        java.lang.String message,
                        java.util.Dictionary properties)
Description copied from class: AbstractReporter
Implementation of report creation and publication after checking the severity.

Specified by:
doReport in class AbstractReporter
Parameters:
severity - The severity of the report.
categories - The categories the report pertains to or null if no catagories are related.
message - The message associated with the report or null to not include a message.
properties - The properties of the report or null if no properties are specified.

isSeverityEnabled

public boolean isSeverityEnabled(int severity)
Description copied from interface: IReporter
Returns true if the specified severity level is enabled.

Specified by:
isSeverityEnabled in interface IReporter
Parameters:
severity - The severity to check.
Returns:
True if the specified severity level is enabled.

lookupReservedService

protected java.lang.Object lookupReservedService(java.lang.String identifier)
Description copied from class: AbstractContext
Returns the reserved service if the specified identifier is one of the reserved identifiers or null if these conditions are not met.

Overrides:
lookupReservedService in class AbstractContext
Parameters:
identifier - The identifier of the service to return, will never be null.
Returns:
The reserved service if the specified identifier is one of the reserved identifiers or null if these conditions are not met.

lookupInheritedService

protected java.lang.Object lookupInheritedService(java.lang.String identifier)
Description copied from class: AbstractContext
Returns a service registered under the specified identifier in any ancestor registry or null if no such service exists.

Overrides:
lookupInheritedService in class AbstractContext
Parameters:
identifier - The identifier of the service to return, will never be null.
Returns:
A service registered under the specified identifier in any ancestor registry or null if no such service exists.

lookupAllInheritedServices

protected java.lang.Object[] lookupAllInheritedServices(java.lang.String identifier)
Description copied from class: AbstractContext
Returns all the services registered under the specified identifier in any ancestor registry or null if no such services can be found.

Overrides:
lookupAllInheritedServices in class AbstractContext
Parameters:
identifier - The identifier of the services to return, will never be null.
Returns:
All the services registered under the specified identifier in any ancestor registry or null if no such services can be found.

getProcessID

public final java.lang.String getProcessID()
Description copied from interface: IProcessContext
Returns the ID of this process.

Specified by:
getProcessID in interface IProcessContext
Returns:
The ID of this process.

getProperty

public final java.lang.Object getProperty(java.lang.String propertyName)
                                   throws java.lang.NullPointerException
Description copied from interface: IProcessContext
Returns the value of the process-level configuration property with the specified name or null if no such property exists.

Specified by:
getProperty in interface IProcessContext
Parameters:
propertyName - The name of the configuration property to return.
Returns:
The value of the process-level configuration property with the specified name or null if no such property exists.
Throws:
java.lang.NullPointerException - If the supplied property name is null.

loadClass

public final java.lang.Class loadClass(java.lang.String className)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.NullPointerException
Description copied from interface: IProcessContext
Loads a class visible to the process.

Specified by:
loadClass in interface IProcessContext
Parameters:
className - The name of the class to load.
Returns:
The requested class instance.
Throws:
java.lang.ClassNotFoundException - If a class with the specified name cannot be found.
java.lang.NullPointerException - If the supplied class name is null.

getSessionID

public final java.lang.String getSessionID()
Description copied from interface: ISessionContext
Returns the ID of the current session.

Specified by:
getSessionID in interface ISessionContext
Returns:
The ID of the current session.

getAttributeNames

public final java.lang.String[] getAttributeNames()
Description copied from interface: ISessionContext
Returns the names of all the session-level attributes currently registered.

Specified by:
getAttributeNames in interface ISessionContext
Returns:
The names of all the session-level attributes currently registered.

getAttribute

public final java.lang.Object getAttribute(java.lang.String attributeName)
                                    throws java.lang.NullPointerException
Description copied from interface: ISessionContext
Returns the value of a session-level attribute with the specified name or null if no such attribute exists.

Specified by:
getAttribute in interface ISessionContext
Parameters:
attributeName - The name of the session attribute to return.
Returns:
The value of a session-level attribute with the specified name or null if no such attribute exists.
Throws:
java.lang.NullPointerException - If the supplied attribute name is null.

setAttribute

public final void setAttribute(java.lang.String attributeName,
                               java.lang.Object attributeValue)
                        throws java.lang.NullPointerException
Description copied from interface: ISessionContext
Sets the value of a session-level attribute or clears it if the supplied value is null.

Specified by:
setAttribute in interface ISessionContext
Parameters:
attributeName - The name of the session attribute to set.
attributeValue - The value to set the attribute to or null to clear the attribute.
Throws:
java.lang.NullPointerException - If the supplied attribute name is null.

clearAttribute

public final void clearAttribute(java.lang.String attributeName)
                          throws java.lang.NullPointerException
Description copied from interface: ISessionContext
Clears the value of a session-level attribute.

Specified by:
clearAttribute in interface ISessionContext
Parameters:
attributeName - The name of the session attribute to clear.
Throws:
java.lang.NullPointerException - If the supplied attribute name is null.

getExecutionID

public final java.lang.String getExecutionID()
Description copied from interface: IExecutionContext
Returns the ID of this execution.

Specified by:
getExecutionID in interface IExecutionContext
Returns:
The ID of this execution.

getParameterNames

public final java.lang.String[] getParameterNames()
Description copied from interface: IExecutionContext
Returns the names of the parameters available to the execution sequence.

Specified by:
getParameterNames in interface IExecutionContext
Returns:
The names of the parameters available to the execution sequence.

getParameter

public final java.lang.String getParameter(java.lang.String parameterName)
                                    throws java.lang.NullPointerException
Description copied from interface: IExecutionContext
Returns the value of the execution-level parameter with the specified name or null if no such parameter exists.

Specified by:
getParameter in interface IExecutionContext
Parameters:
parameterName - The name of the parameter to return.
Returns:
The value of the execution-level parameter with the specified name or null if no such parameter exists.
Throws:
java.lang.NullPointerException - If the supplied parameter name is null.

getParameters

public final java.lang.String[] getParameters(java.lang.String parameterName)
                                       throws java.lang.NullPointerException
Description copied from interface: IExecutionContext
Returns the values of the execution-level parameter with the specified name or null if no such parameter exists.

Specified by:
getParameters in interface IExecutionContext
Parameters:
parameterName - The name of the parameter to return.
Returns:
The values of the execution-level parameter with the specified name or null if no such parameter exists.
Throws:
java.lang.NullPointerException - If the supplied parameter name is null.

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String value)
                  throws java.lang.NullPointerException
Description copied from interface: IExecutionContext
Sets the value of the execution-level parameter with the specified name or clears it if the value is null.

Specified by:
setParameter in interface IExecutionContext
Parameters:
parameterName - The name of the parameter to set.
value - The value of the execution-level parameter with the specified name or null to clear the value.
Throws:
java.lang.NullPointerException - If the supplied parameter name is null.

setParameters

public void setParameters(java.lang.String parameterName,
                          java.lang.String[] values)
                   throws java.lang.NullPointerException
Description copied from interface: IExecutionContext
Sets the values of the execution-level parameter with the specified name or clears them if the value is null or empty.

Specified by:
setParameters in interface IExecutionContext
Parameters:
parameterName - The name of the parameters to set.
values - The values of the execution-level parameter with the specified name or null or to clear the values.
Throws:
java.lang.NullPointerException - If the supplied parameter name is null.

clearParameter

public void clearParameter(java.lang.String parameterName)
                    throws java.lang.NullPointerException
Description copied from interface: IExecutionContext
Clears the value of the execution-level parameter with the specified name.

Specified by:
clearParameter in interface IExecutionContext
Parameters:
parameterName - The name of the parameter to clear.
Throws:
java.lang.NullPointerException - If the supplied parameter name is null.

createResult

public final IActionResult createResult(java.lang.String resultName)
Description copied from interface: IActionContext
Creates an action result with the specified name.

Specified by:
createResult in interface IActionContext
Parameters:
resultName - The name of the result to create or null to create an undefined result.
Returns:
A new action result with the specified name.